<template>
    <div>
     Clicked:{{count}} times {{count}} 是
     <div>
    <ul v-for="user in users" :key="user.name">
      <li>
        <p>
          <label>用户名</label>:
          <span>{{user.name}}</span>
        </p>
        <p>
          <label>邮箱</label>:
          <span>{{user.email}}</span>
        </p>
      </li>
    </ul>
  </div>
     <div>
      <button @click="increment">+</button>
      <button @click="decrement">-</button>
     </div>
     
    </div> 
</template>

<script>
import {createNamespacedHelpers} from 'vuex'
    const {mapState,mapActions,mapGetters}  = createNamespacedHelpers("users");
    const{mapState:demoMapState,mapActions:demoMapActions} = createNamespacedHelpers("count");
//import {mapState,mapActions, mapGetters} from "vuex"
    export default {
        data() {  
            return {
                type:''
            }
        },
       async mounted() {
          await this.load()  
        },
        computed: {
            ...mapState({   
                users:state =>state.users
            }),
            ...demoMapState({
              count:state =>state.count
            }),
            ...mapGetters(["filters"])
           
        //   evenOrOdd(){
        //      return this.count%2 ===0 ?"偶数":"奇数"
        //   }
        },
        methods: {
            ...demoMapActions(["increment","decrement"]),
            ...mapActions(["load"])
        },
    }
</script>

<style lang="sass" scoped>

</style>